package datamining.miner.general;

import java.io.Serializable;
import java.util.Collection;

import datamining.common.Frequented;
import datamining.miner.chain.Extension;
import datamining.sequence.IndexedItem;
import datamining.sequence.Sequence;

/**
 * This interface declares the functionality of an embedding between a subgraph
 * and its supergraph An embedding maps each node and each edge of a subgraph to
 * exactly one edge of the supergraph
 * 
 */
public interface Embedding<ItemType> extends
		Frequented, Serializable {

	/**
	 * @return 这个embedding的原始序列
	 */
	public IndexedSequence<ItemType> getIndexedSequence();

	/**
	 * @return 返回embedding的子序列
	 */
	public Sequence<ItemType> getSubSequence();
	

	/**
	 * @author xujinghu
	 * @date 2012-12-8下午9:18:43
	 * @param superItem
	 * @return 超序列中的项在子序列中的对应项
	 */
	public IndexedItem<ItemType> getSubSequenceItem(IndexedItem<ItemType> superItem);

	/**
	 * @return 返回embedding的父序列
	 */
	public Sequence<ItemType> getSuperSequence();

	/**
	 * @author xujinghu
	 * @date 2012-12-8下午9:21:24
	 * @param subItem
	 * @return 子序列中的项在父序列中的对应项
	 */
	public IndexedItem<ItemType> getSuperSequenceItem(IndexedItem<ItemType> subItem);


	/**
	 * checks if the current and the given embedding share common nodes
	 * 
	 * @param other
	 * @param ignore
	 *            node with labels inside ignore will be ignored (may be
	 *            <code>null</code>)
	 * @return <code>true</code>, if there are common nodes
	 */
	public boolean overlaps(Embedding<ItemType> other,
			Collection<ItemType> ignore);

	/**
	 * @author xujinghu
	 * @date 2012-12-18下午10:58:26
	 * @param ext
	 * @param itemExtend
	 * @return 扩展过后的embedding
	 */
	public Embedding<ItemType> extend(Extension<ItemType> ext, IndexedItem<ItemType> itemExtend);

}
